package com.lancoo.klgcourseware.ui.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.ivan.stu.dialoglib.xPopup.XPopupManager;
import com.lancoo.klgcourseware.ui.widget.KlgCustomViewPager;
import java.util.ArrayList;
import java.util.List;


/**
 * Created by pengmi on 2018/9/17.
 * Description:图文混排中,图片浏览界面
 */

public class KlgImageViewPagerActivity extends AppCompatActivity {

    protected KlgCustomViewPager viewPager;
    protected TextView tv_index;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }


    /**
     * @param mContext 上下文
     * @param urls 图片url集合
     * @param position  当前选中图片下标
     */
    public static void launch(Context mContext,List<String> urls,int position){
        Intent mIntent=new Intent(mContext,KlgImageViewPagerActivity.class);
        mIntent.putExtra("currentIndex",position);
        mIntent.putStringArrayListExtra("imgUrls",(ArrayList<String>) urls);
        mContext.startActivity(mIntent);
    }


    private static long time;
    public static void launch(Context mContext,ImageView imageView,List<String> urls,int position){
        if(System.currentTimeMillis()-time<500){
            return;
        }
        time=System.currentTimeMillis();
        XPopupManager.showImageViewPopup(mContext,imageView,position,urls,null);
    }




}